import 'package:flutter/material.dart';
import 'package:flutter_2b_client/apis/FactoryApi.dart';
import 'package:flutter_2b_client/apis/GoodsApi.dart';
import 'package:flutter_2b_client/apis/GoodsBrandApi.dart';
import 'package:flutter_2b_client/apis/GoodsCategoryApi.dart';
import 'package:flutter_2b_client/components/EditGoodsForm.dart';
import 'package:flutter_2b_client/components/LoadableIconButton.dart';
import 'package:flutter_2b_client/model/IntIdAndName.dart';
import 'package:flutter_2b_client/pages/ScanBarcodePage.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';

import '../components/GoodsUnitEditor.dart';
import '../components/LoadingButton.dart';

class AddGoodsPage extends HookWidget {
  const AddGoodsPage({Key? key}) : super(key: key);
  static String path = "/goods/new";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('新增商品')),
      body: EditGoodsForm(
        onSave: (AddGoodsRequest request) async {
          await goodsApi.createGoods(
            request,
          );
        },
      ),
    );
  }
}
